<script setup>
import { ref, onMounted } from 'vue';
import { useRouter } from "vue-router";
import { useCounterStore } from "@/stores/counter.js";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';

const loading = ref(true);
const { setRegionMap } = useCounterStore();
const router = useRouter();

onMounted(async () => {
  await initData();
  loading.value = false;
})

const initData = async () => {
  const mapData = await import(/* @vite-ignore */ `@/assets/json/China_Province_mapping.json`);
  await setRegionMap(mapData.default);
}

</script>

<template>  
  <el-config-provider :locale="zhCn">
    <div v-loading="loading" element-loading-text="努力加载中，请稍后..." id="main">
      <RouterView v-if="!loading"></RouterView>
    </div>
  </el-config-provider>
</template>

<style scoped lang="less">
#main {
  background-color: var(--el-bg-color-page);
  font-size: var(--el-font-size-base);
  height: 100vh;
  width: 100vw;
}
</style>
